const express = require('express');
const router = express.Router();
// 导入验证规则中间件
const expressJoi = require('@escook/express-joi')
// 导入需要验证的规则对象
const { reg_login_schema, reg_register_schema } = require('../schema/user')

const user_handler = require('../controllers/userController')

/* GET home page. */
// 生成验证码
router.get('/code', user_handler.vericode)
// 注册新用户
router.post('/register', expressJoi(reg_register_schema) ,user_handler.regUser);
// 登录
router.post('/login', expressJoi(reg_login_schema), user_handler.login);



module.exports = router;
